package com.caesar.exer1;

import java.util.ArrayList;
import java.util.Collection;
import java.util.function.Predicate;

/**
 * @author caesar
 * @date 2025/7/16
 * @Description:
 * @apiNote
 */
public class TestString {
    public static void main(String[] args) {
        Collection<String> coll = new ArrayList<String>();
        coll.add("hello");
        coll.add("java");
        coll.add("world");
        coll.add("atguigu");
        coll.add("love");
        coll.add("you");
        coll.add("mom");
        coll.add("dad");
        coll.add("noon");

        System.out.println("coll中的单词有：" + coll);

        Predicate<String> p = new Predicate<String>() {
            @Override
            public boolean test(String word) {
                return new StringBuilder(word).reverse().toString().equals(word);
            }
        };
        coll.removeIf(p);

        System.out.println("coll中删除回文单词后：" + coll);
    }
}
